<template>
  <div>
    <!-- 外层容器 -->
    <el-container>
      <!-- 上半区域：顶栏 -->
      <el-header class="layout-header">
        <el-row :gutter="20">
          <el-col :span="12">
            <p ><i class="el-icon-s-home" style="margin-right: 10px"/>家政管理平台</p>
          </el-col>
          <el-col :span="12">
            <el-button type="text" style="font-size: 15px;color: #fff;float:right;margin-top: 8px" @click="getOut">退出登录</el-button>
          </el-col>
        </el-row>
      </el-header>
      <!-- 下半区域 -->
      <el-container class="layout-body">
        <!-- 下半区域的左侧边栏 -->
        <el-aside class="layout-aside" style="width: 170px">
          <el-menu
              router
              :default-active="activeMenuItemPath"
              class="el-menu-vertical-demo"
              background-color="#222"
              text-color="#fff"
              active-text-color="#fff">
            <!-- 首页 -->
            <el-menu-item index="/admin/index">
              <i class="el-icon-s-home"></i>
              <span>首页</span>
            </el-menu-item>
            <!-- 商品管理 -->
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-s-goods"></i>
                <span>服务管理</span>
              </template>
              <el-menu-item index="/admin/category/list" >
                <i class="el-icon-s-unfold"></i>
                <span slot="title">服务类别</span>
              </el-menu-item>
              <el-menu-item index="/admin/category/item/list" >
                <i class="el-icon-s-goods"/>
                <span slot="title">服务列表</span>
              </el-menu-item>
            </el-submenu>

            <!-- 订单管理 -->
            <el-submenu index="3" >
              <template slot="title">
                <i class="el-icon-s-release"></i>
                <span>订单管理</span>
              </template>
              <el-menu-item index="/admin/order/list" >
                <i class="el-icon-s-order"/>
                <span slot="title">订单列表</span>
              </el-menu-item>
            </el-submenu>

            <!-- 商家管理 -->
            <el-submenu index="4" >
              <template slot="title">
                <i class="el-icon-s-data"></i>
                <span>评论管理</span>
              </template>
              <el-menu-item index="/admin/Review/moderation" >
                <i class="el-icon-s-comment"/>
                <span>评论列表</span>
              </el-menu-item>
            </el-submenu>
            <!-- 权限管理 -->
            <el-submenu index="5" >
              <template slot="title">
                <i class="el-icon-s-check"></i>
                <span>权限管理</span>
              </template>
              <el-menu-item index="/admin/list">
                <i class="el-icon-s-custom"></i>
                <span>管理员列表</span>
              </el-menu-item>
              <el-menu-item index="/admin/add-new">
                <i class="el-icon-s-operation"></i>
                <span>新增管理员</span>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <!-- 下半区域的右侧主体 -->
        <el-main class="layout-main">
          <!-- 由其它视图来显示 -->
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style>
.layout-header {
  background: #409eff;
}

.layout-header p {
  color: #fff;
  line-height: 60px;
  font-size: 20px;
}

.layout-body {
  position: absolute;
  top: 60px;
  bottom: 0;
  left: 0;
  right: 0;
}

.layout-aside {
  background: #222;
}

.layout-aside i {
  color: #fff !important;
}

.layout-aside span{
  font-size: 10px;
}

.layout-main {
  background: #fff;
}

.el-menu-item.is-active {
  background: #2d3c4d !important;
}
</style>

<script>
export default {
  data() {
    return {
    }
  },
  methods:{
    getOut(){
      this.$router.push('/admin/login');
      localStorage.removeItem("jwt")
    }
  },
  mounted() {

  }
}
</script>